[% setvar title Method calls should not suffer from the action on a distance %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Method calls should not suffer from the action on a distance</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Ilya Zakharevich &lt;<a href='mailto:ilya@math.ohio-state.edu'>ilya@math.ohio-state.edu</a>&gt;
  Date: 15 Sep 2000
  Mailing List: <a href='mailto:perl6-language@perl.org'>perl6-language@perl.org</a>
  Number: 244
  Version: 1
  Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>This RFC proposes to remove indirect object syntax, and modify the
semantic of the <code>-&gt;</code> operator.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<a name='-&gt;'></a><h2>-&gt;</h2>
<p>Currently,</p>
<pre>  foo-&gt;bar($baz)</pre>
<p>can be parsed either as <code>&lt;'foo'-</code>bar($baz)&gt;&gt;, or as <code>&lt;foo()-</code>bar($baz)&gt;&gt;
depending on how the symbol <code>foo</code> was used on other places.  The proposal
is to always choose the first meaning: make <code>-&gt;</code> autoquote the bareword
on the left.</p>
<p>This interpretation is more desirable on esthetical ground, since</p>
<pre>  'foo'-&gt;bar($baz)</pre>
<p>looks visually clattered, but <code>&lt;foo()-</code>bar($baz)&gt;&gt; looks as if it expresses
its meaning.  The default choice is done so that if you need other
choice, your code does not look artificial.</p>
<a name='Parentheses'></a><h2>Parentheses</h2>
<pre>  foo-&gt;bar($baz, $coon)</pre>
<p>should be made synonymous with</p>
<pre>  foo-&gt;bar $baz, $coon</pre>
<p>I can see no ambiguity in this call, but it not always works with Perl5.</p>
<a name='Indirect object syntax'></a><h2>Indirect object syntax</h2>
<p>Currently,</p>
<pre>  bar foo $baz</pre>
<p>can be parsed either as <code>&lt;'foo'-</code>bar($baz)&gt;&gt;, or as <code>&amp;bar(&amp;foo($baz))</code>,
depending on how the symbols <code>foo</code> and <code>bar</code> were used on other places.</p>
<p>There only way to avoid the action at a distance is to prohibit one of these
interpretations.  Since the other way <code>&lt;foo-</code>bar $baz&gt;&gt; to write this
method call is as convenient as the indirect object syntax, the proposal
is to prohibit the indirect object method calls altogether.</p>
<p>Make the above syntax be interpreted as <code>&amp;bar(&amp;foo($baz))</code>.</p>
<a name='MIGRATION ISSUES'></a><h1>MIGRATION ISSUES</h1>
<p>Translate Perl5 code as specified above.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>Remove the DWIM logic from the parser.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>None.</p>
</div>
